﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace DataSync.Entity
{

    public class FileReaderConfig : CollectConfigBase
    {
        public string FileName { get; set; }
        /// <summary>
        /// 本地数据存放目录
        /// </summary>
        private string localDir;

        public string LocalDir
        {
            get { return localDir; }
            set
            {
                if (!Directory.Exists(value))
                {
                    Directory.CreateDirectory(value);
                }

                localDir = value;
            }
        }

        /// <summary>
        /// 本地备份目录，可为空
        /// </summary>
        public string BackDir { get; set; }

        ///<summary>
        /// 是否删除原文件
        /// </summary>
        public bool DeleteSourceFile { get; set; }
    }

    public class LocalFileConfig : FileReaderConfig
    {
        public LocalFileConfig() { }
        public LocalFileConfig(FileReaderConfig basecnf)
        {
            this.BackDir = basecnf.BackDir;
            this.DeleteSourceFile = basecnf.DeleteSourceFile;
            this.FileName = basecnf.FileName;
            this.LocalDir = basecnf.LocalDir;
        }

        /// <summary>
        /// 远程数据存放目录
        /// </summary>
        public string RemortDir { get; set; }
        /// <summary>
        /// 文件匹配符
        /// </summary>
        public string FileMatch { get; set; }

        /// <summary>
        /// 源目录
        /// </summary>
        public string ReadDir { get; set; }
    }
}
